<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <script th:src="@{/}+'js/tool.js'"></script>
  <style type="text/css">
    .layui-form .layui-form-item{
      width:90%;
    }
    .layui-input-inline{
      width:350px!important
    }
  </style>

</head>
<body style="margin-top: 100px">
<form class="layui-form" lay-filter="myform" id="myform">
  <div class="layui-form-item">
    <label class="layui-form-label">选取题数</label>
    <div class="layui-input-inline">
      <input type="number" id="num" name="num" autocomplete="off" class="layui-input">
    </div>
  </div>
</form>
<table class="layui-hide"  id="main-table" lay-filter="main-table"></table>
<script>
  var joinid2 = snowId();//生成单次选择唯一ID
  let joinid = `[[${joinid}]]`
  layui.use(['form', 'table', 'laydate'], function(){
    var form = layui.form
            ,table = layui.table;
    table.render({
      elem: '#main-table'
      ,height: '500px'
      ,url: 'libQuestion/selectList'
      ,where:{joinid:joinid}
      ,title: '题目列表'
      ,toolbar: '#toolbar'
      ,cols: [
        [
          {field: 'code', title: "编号",width:90}
          ,{field: 'text', title: "题干",width:320}
          ,{field: 'pianName', title: "篇",width:180}
          ,{field: 'chapterName', title: "章",width:180}
          ,{field: 'jieName', title: "节",width:250}
          ,{field: 'knowledgeName',title: "知识点",width:250}
          ,{field: 'difficultyTxt',title: "难度",width:90}
          ,{field: 'questionTypeTxt',title: "题型",width:100}
          ,{field: 'contentTypeTxt',title: "试题类型",width:120}
          ,{field: 'paperTypeTxt',title: "试卷类型",width:120}
          ,{field: 'lgTxt',title: "语言",width:90}
        ]
      ]
      ,done:function(){
        enableRowClick(table,form,'main-table',"main-table");
      }
    });
    table.on('toolbar(main-table)', function(obj){
      switch(obj.event){
        case 'getResult':
          table.reload("main-table",{url:'libQuestion/selectList',where:{joinid:joinid,joinid2:joinid2,num:$("#num").val()}})
          // axios.get("libQuestion/selectList",{params:{joinid:joinid}}).then(res=>{
          //
          // })
          break;
      }
    })
  })
</script>
<script type="text/html" id="toolbar">
  <div class="layui-btn-group">
    <button class="layui-btn layui-btn-sm" lay-event="getResult"><i class="layui-icon layui-icon-survey"></i>抽题</button>
  </div>
</script>
</body>
</html>

</body>
</html>